<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/RanchBuddy.Master" Inherits="RanchBuddy.Web.Services.MyViewPage<RanchBuddy.Core.Domain.Impl.Company>" %>
<%@ Import Namespace="RanchBuddy.Web.Controllers"%>
<%@ Import Namespace="Microsoft.Web.Mvc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <fieldset>
        <legend><%= Model.Name %></legend>
        <div style="float:left;">
            <p>
                Type: <%= Html.Encode(ViewData["CompanyType"]) %>
            </p>
            <p>
                <a href="<%= Html.Encode(Model.WebsiteURL) %>"><%= Html.Encode(Model.WebsiteURL) %></a>
            </p>
            <p>
                <a href="mailto:<%= Html.Encode(Model.Email) %>"><%= Html.Encode(Model.Email) %></a>
            </p>
            <p>
                Phone 1:
                <%= Html.Encode(Model.Phone1) %>
            </p>
            <p>
                Phone 2:
                <%= Html.Encode(Model.Phone2) %>
            </p>
            <p>
                <%= Html.Encode(Model.Address1) %><br />
                <%= Html.Encode(Model.Address2) %><br />
                <%= Html.Encode(Model.City) %>, <%= Html.Encode(Model.State) %> <%= Html.Encode(Model.ZipCode) %>
            </p>
            <p>
                Latitude:
                <%= Html.Encode(Model.Latitude) %>
            </p>
            <p>
                Longitude:
                <%= Html.Encode(Model.Longitude) %>
            </p>
            <p>
                Create Date:
                <%= Html.Encode(String.Format("{0:g}", Model.CreateDate)) %>
            </p>
            <p>
                Update Date:
                <%= Html.Encode(String.Format("{0:g}", Model.UpdateDate)) %>
            </p>
        </div>
        <br />
        <div id="mapDiv">
            <% Html.RenderPartial("Map", Model); %>
        </div>
    </fieldset>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#ZipCode").blur(function(evt) {
                $("#Latitude").val("");
                $("#Longitude").val("");

                var address = jQuery.trim($("#Address1").val()) + " " + jQuery.trim($("#Address2").val()) + " " + jQuery.trim($("#City").val()) + " " + jQuery.trim($("#State").val()) + " " + jQuery.trim($("#ZipCode").val());
                if (address.length < 1)
                    return;

                FindAddressOnMap(address);
            });
        });
        </script>
        
        <%= Html.ActionLink("Edit","Edit", new {id=Model.CompanyID}) %> 
        <%= Html.ActionLink("Back to List","Index") %> 
        <%=Html.ActionLink("Associate myself with this company!", "AssociateAccount",
                                      new {Model.CompanyTypeID, Model.CompanyID}) %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>

